<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue-transsition</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        .v-enter-from{
            color: red;
            opacity: 0;
        }
        .v-enter-active{
            transition: all 3s ease;
        }
        .v-enter-to{
            color: yellow;
            opacity: 1;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script>
        const app=Vue.createApp({
            data(){
                return {
                    show:true
                }
            },
            methods:{
                handleClick(){
                    if(this.show===true){
                        this.show=false
                    }else{
                        this.show=true
                    }
                },
                handleBeforeEnter(el){
                    // el.style.color='yellow'
                    // el.style.opacity=0
                },
                handerEnter(el,done){
                    
                    // el.style.color='red'
                    // el.style.opacity=1 
                },handleAfterEnter(el){
               
                }
            },
            template:`<transition 
             appear
                 @before-enter='handleBeforeEnter'
                @enter='handerEnter'
                @after-enter='handleAfterEnter'><div v-if='show'
                >hello word</div>
                </transition>  <button @click='handleClick'>按钮</button>`
        })
        app.mount('#root')
    </script>
</body>
</html>